<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<style>

    #bootstrap-table tr:nth-child(even) {
        background: transparent !important;
    }

    #bootstrap-table th {
        background: transparent !important;
    }

    #bootstrap-table a {
        width: 100%;
        height: 100%;
        display: block;
        color: #000000;
    }

    #bootstrap-table a:hover {
        color: #000000;
    }

    #bootstrap-table a:visited {
        color: #000000;
    }

    #bootstrap-table a:active {
        color: #000000;
    }
</style>
<body class="hold-transition skin-yellow sidebar-mini">
<section class="content-header">
    <h1>外协件采购计划明细</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" class="form-horizontal">
                        <div class="row">
                            <div class="form-inline" style="padding-left: 30px">
                                <div class="form-group" style="margin-right: 25px;">
                                    <label>生产令编号：</label>
                                    <label th:text="${prodOrd.prodNo}"></label>
                                </div>
                                <div class="form-group" style="margin-left:0px;margin-right: 25px;">
                                    <label>项目名称：</label>
                                    <label th:text="${project.proName}"></label>
                                </div>
                                <div class="form-group" style="margin-left:0px;margin-right: 25px;">
                                    <label>数量：</label>
                                    <label th:text="${prodOrd.prodNum}"></label>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-inline" style="padding-left: 15px">
                                <input th:value="${prodOrd.prodNo}" name="rppProdNo" style="display: none"
                                       type="hidden"/>
                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">
                                    <label class="control-label">
                                        物料描述
                                    </label>
                                    <label class="control-label">
                                        <input name="rppMatDesc" class="form-control" type="text" maxlength="255"
                                               placeholder="请输入物料描述"/>
                                    </label>
                                </div>
                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">
                                    <label class="control-label">
                                        部分
                                    </label>
                                    <label class="control-label">
                                        <input name="rppPart" class="form-control" type="text" maxlength="255"
                                               placeholder="请输入部分"/>
                                    </label>
                                </div>
                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">
                                    <label class="control-label">
                                        类型
                                    </label>
                                    <label class="control-label">
                                        <select name="rppMalType" class="form-control">
                                            <option value=""> -- 请选择 --</option>
                                            <option th:each="item:${rppMalTypeList}" th:value="${item}"
                                                    th:text="${item}"></option>
                                        </select>
                                    </label>
                                </div>
                                <!--                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">-->
                                <!--                                    <label class="control-label">-->
                                <!--                                        类型-->
                                <!--                                    </label>-->
                                <!--                                    <label class="control-label">-->
                                <!--                                        <input th:value="${prodNo}" name="prodNo" style="display: none" type="hidden"/>-->
                                <!--                                        <select name="rppTypeId" class="form-control">-->
                                <!--                                            <option value="">全部</option>-->
                                <!--                                            <option value="1">原材料</option>-->
                                <!--                                            <option value="2">外购件</option>-->
                                <!--                                            <option value="3">外协件</option>-->
                                <!--                                        </select>-->
                                <!--                                    </label>-->
                                <!--                                </div>-->
                                <button id="btn-search" type="button" class="btn btn-success">
                                    搜索
                                </button>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    let table;
    $(function () {
        /**
         * 加载列表
         */
        table = js.table.init({
            url: ctx + "task/outBuyListView/viewDetail/list",
            showColumns: false,
            showExport: false,
            columns: [
                {
                    title: '序号', width: '60',
                    formatter: function (value, row, index, field) {
                        var pageSize = table.bootstrapTable('getOptions').pageSize;
                        var pageNumber = table.bootstrapTable('getOptions').pageNumber;
                        return pageSize * (pageNumber - 1) + index + 1;
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '类型', field: 'rppMalType', width: '70',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '部分', field: 'rppPart',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '物料描述', field: 'rppMatDesc',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '数量', field: 'rppNum',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '单位', field: 'rppUnit',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '图号', field: 'rppDiagram',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '外协类型', field: 'rppAssistType',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '提报人', field: 'rppDesigner',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '提报部门', field: 'rppDesignerDept',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '采购物料描述', field: 'sppMatDesc',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '采购数量', field: 'sppNum',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '是否回货', field: 'rppConfirmReturnDate',
                    formatter: function (value, row, index) {
                        if (value === null) {
                            return '未回货';
                        } else{
                            return '已回货';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                },
                {
                    title: '回货日期', field: 'rppConfirmReturnDate',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }
                    }, cellStyle: function (value, row, index) {
                        return {css: {"background": "#FFFFFF"}}
                    }
                }
            ]
        });
        /**
         * 表格搜索
         */
        $("#btn-search").click(function () {
            js.table.search(table);
        });
    });
</script>
</body>
</html>